<?php

namespace App\Http\Requests\V1;

class ProfileUpdateRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return parent::authorize();
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = parent::rules();
        $rules['isAdmin'] = 'bail|required|boolean';
        $rules['code'] = 'bail|required';
        $rules['mobile'] = 'bail|required';
        return $rules;
    }

    /**
     * Get custom messages for validator errors.
     *
     * @return array
     */
    public function messages()
    {
        $message = parent::messages();
        $messages['isAdmin.required'] = '身份类型不能为空';
        $messages['isAdmin.boolean'] = '身份类型错误';
        $messages['code.required'] = '登录账号不能为空';
        $messages['code.exists'] = '登录账号不存在';
        $messages['mobile.required'] = '手机号码不能为空';
        $messages['mobile.digits'] = '手机号码格式不正确';
        $messages['telephone.digits_between'] = '办公电话格式不正确';
        $messages['email.email'] = '电子邮箱格式不正确';
        return $message;
    }
}
